home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Oct 90 / MacApp.Tech$ 10⁄5⁄90 / 2078-Items in Lists-Sep90 < prev    next >
Encoding:
Text File  |  1991-03-06  |  1.2 KB  |  49 lines  |  [TEXT/GEOL]

  1. Item    7114194                         29-Sept-90        12:51PDT
  2.  
  3. From:   MORTENSEN.K                     Mortensen, Keith
  4.  
  5. To:     MACAPP.TECH$                    MacApp Technical
  6.  
  7. Sub:    Items in Lists
  8.  
  9. Could someone help me with a particular problem with lists and MacAPP?
  10.  
  11. I have a dialog with a list, an OK and Cancel button.
  12.  
  13. As soon as the dismisser OK button is hit, I want to know what item was
  14. selected or double-clicked in the list TMyListView.
  15.  
  16.  
  17.  
  18. class TMyListView : public TTextListView {
  19. public:
  20.    pascal virtual void GetItemText(short anItem, StringPtr aString);
  21. };
  22.  
  23.  
  24. void ShowListDialog()
  25. {
  26.    const   IDType kDialogView   = 'dlog';  // dialog view identifier
  27.    const   IDType kOK        = 'okok'; // OK button identifier
  28.    const   IDType kCancel     = 'cncl';// Cancel button identifier
  29.  
  30.    Str255  aString;
  31.  
  32.    TWindow *aWindow = NewTemplateWindow(kListWindowID, NULL);
  33.    TDialogView *aDialogView = (TDialogView *) aWindow->FindSubView(kDialogView)
  34.    IDType dismisser = aDialogView->PoseModally();
  35.  
  36.    if (dismisser == kOK)
  37.    {
  38.     // Need to know which item in list was selected or double-clicked.
  39.    }
  40.  
  41.    aWindow->Close();   // dispose of the dialog window
  42. }
  43.  
  44.  
  45. Keith Mortensen
  46. Apple Computer, Inc.
  47. MORTENSEN.K
  48.  
  49.